<template>
	<view class="content">
		<view class="top">
			<view class="top_1">
				<text @click="type=1,getinfo()" :style="{
					fontSize:type==1?'32rpx':'',
					fontWeight:type==1?'bold':'',
					color:type==1?'#FF1B1B':'',
				}">新闻资讯</text>
				<text v-if="type==1"></text>
			</view>
			<view class="top_1">
				<text @click="type=2,getinfo()" :style="{
					fontSize:type==2?'32rpx':'',
					fontWeight:type==2?'bold':'',
					color:type==2?'#FF1B1B':'',
				}">企业资讯</text>
				<text v-if="type==2"></text>
			</view>
		</view>
		<view class="zixun" @click="submit(item)" v-for="(item,index) in info.data">
			<view class="zixun1">
				<image :src="item.image" class="zixun_1" />
				<view class="zixun_2">
					<text>{{item.title}}</text>
					<text>{{item.describe}}</text>
				</view>
			</view>
			<view class="xian">

			</view>
			<view class="zixun_3">
				查看详情
			</view>
		</view>
		<u-loadmore :status="status" :load-text="loadText" @loadmore="page++,getinfo()" />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				loadText: {
					loadmore: '加载更多',
					loading: '努力加载中',
					nomore: '实在没有了'
				},
				info: {},
				status: 'loadmore',
				type: 1,
				page: 1
			};
		},
		onLoad() {
			this.getinfo()
		},
		methods: {
			submit(a) {
				uni.navigateTo({
					url: './storeTransferxq?id=' + a.id
				})
			},

			getinfo() {
				this.api('Information/list', {
					type: this.type,
					page: this.page
				}).then(res => {
					if (this.page == 1) {
						if (res.data.data.length < 10) {
							this.status = 'nomore'
						}
						this.info = res.data
					} else {
						if (res.data.data.length == 0) {
							this.status = 'nomore'
							return
						}
						console.log(res.data.data.length);
						if (res.data.data.length < 10) {
							this.status = 'nomore'
						}
						this.info.data.push(...res.data.data)
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.top {
		display: flex;

		.top_1 {
			width: 170rpx;
			text-align: center;

			text:nth-of-type(1) {
				font-size: 28rpx;
				font-family: OPPOSans;
				font-weight: 400;
				color: #181818;
			}

			text:nth-of-type(2) {
				display: block;
				margin: 10rpx auto;
				width: 36rpx;
				height: 10rpx;
				background: #FF1B1B;
				border-radius: 5rpx;
			}
		}
	}


	.zixun {
		position: relative;
		background-color: white;
		padding: 30rpx 30rpx 0rpx 30rpx;

		image {
			width: 199rpx;
			height: 171rpx;
		}

		.xian {
			height: 1px;
			background: #F1F1F1;
			margin-top: 30rpx;
		}

		.zixun1 {
			display: flex;
		}

		.zixun_3 {
			width: 134rpx;
			height: 50rpx;
			border: 1rpx solid #FF1B1B;
			right: 30rpx;
			border-radius: 6rpx;
			font-size: 24rpx;
			font-family: OPPOSans;
			text-align: center;
			line-height: 50rpx;
			position: absolute;
			top: 50%;
			transform: translateY(-50%);
			font-weight: 500;
			color: #FF1B1B;
		}

		.zixun_2 {
			width: 45%;
			margin-left: 30rpx;

			text:nth-of-type(1) {
				font-size: 30rpx;
				font-family: OPPOSans;
				font-weight: bold;
				color: #181818;
			}

			text:nth-of-type(2) {
				display: block;
				font-size: 22rpx;
				font-family: OPPOSans;
				font-weight: 400;
				color: #666666;
				margin-top: 15rpx;
			}

			// border: 1px solid black;
		}
	}
</style>
